package cn.wolfcode.luowowo.test;

import lombok.Getter;

@Getter
public enum MyDate {
    //相当于把DATA1常量对象的属性name,的值是什么;
    DATA1("zhangsan", 15), DATA2;
    private String name;
    private int age;

    private MyDate() {
    }

    private MyDate(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String join(String key) {
        return key;
    }

    public static void main(String[] args) {
        System.out.println(DATA1.join("hha"));
    }
}

/**
 * 上下其实效果是一样的
 */
class MyDateClass {
    public static final MyDateClass DATA1 = new MyDateClass("zhangsan",16);
    public static final MyDateClass DATA2 = new MyDateClass("lisi",16);
    @Getter
    private String name;
    @Getter
    private int age;
    private MyDateClass(String name, int age) {
        this.name = name;
        this.age = age;
    }
}